package com.fuxi.cloud.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * HikariDataSourceConfig
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-05-03
 */
@Component("hikariDataSourceConfig")
@ConfigurationProperties(
        prefix = "spring.datasource.hikari"
)
public class HikariDataSourceConfig {
    private Integer minimumDdle = 5;
    private Integer maximumPoolSize = 15;
    private Integer idleTimeout = 30000;
    private Integer maxLifetime = 30000;
    private String poolName = "HikariCP";
    private String connectionTestQuery = null;
    private Integer connectionTimeout = 30000;
    private Boolean autoCommit = true;

    public HikariDataSourceConfig() {
    }

    public Integer getMinimumDdle() {
        return this.minimumDdle;
    }

    public Integer getMaximumPoolSize() {
        return this.maximumPoolSize;
    }

    public Integer getIdleTimeout() {
        return this.idleTimeout;
    }

    public Integer getMaxLifetime() {
        return this.maxLifetime;
    }

    public String getPoolName() {
        return this.poolName;
    }

    public String getConnectionTestQuery() {
        return this.connectionTestQuery;
    }

    public Integer getConnectionTimeout() {
        return this.connectionTimeout;
    }

    public Boolean getAutoCommit() {
        return this.autoCommit;
    }

    public void setMinimumDdle(Integer minimumDdle) {
        this.minimumDdle = minimumDdle;
    }

    public void setMaximumPoolSize(Integer maximumPoolSize) {
        this.maximumPoolSize = maximumPoolSize;
    }

    public void setIdleTimeout(Integer idleTimeout) {
        this.idleTimeout = idleTimeout;
    }

    public void setMaxLifetime(Integer maxLifetime) {
        this.maxLifetime = maxLifetime;
    }

    public void setPoolName(String poolName) {
        this.poolName = poolName;
    }

    public void setConnectionTestQuery(String connectionTestQuery) {
        this.connectionTestQuery = connectionTestQuery;
    }

    public void setConnectionTimeout(Integer connectionTimeout) {
        this.connectionTimeout = connectionTimeout;
    }

    public void setAutoCommit(Boolean autoCommit) {
        this.autoCommit = autoCommit;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof HikariDataSourceConfig)) {
            return false;
        } else {
            HikariDataSourceConfig var2 = (HikariDataSourceConfig)o;
            if (!var2.canEqual(this)) {
                return false;
            } else {
                label107: {
                    Integer var3 = this.getMinimumDdle();
                    Integer var4 = var2.getMinimumDdle();
                    if (var3 == null) {
                        if (var4 == null) {
                            break label107;
                        }
                    } else if (var3.equals(var4)) {
                        break label107;
                    }

                    return false;
                }

                Integer var5 = this.getMaximumPoolSize();
                Integer var6 = var2.getMaximumPoolSize();
                if (var5 == null) {
                    if (var6 != null) {
                        return false;
                    }
                } else if (!var5.equals(var6)) {
                    return false;
                }

                Integer var7 = this.getIdleTimeout();
                Integer var8 = var2.getIdleTimeout();
                if (var7 == null) {
                    if (var8 != null) {
                        return false;
                    }
                } else if (!var7.equals(var8)) {
                    return false;
                }

                label86: {
                    Integer var9 = this.getMaxLifetime();
                    Integer var10 = var2.getMaxLifetime();
                    if (var9 == null) {
                        if (var10 == null) {
                            break label86;
                        }
                    } else if (var9.equals(var10)) {
                        break label86;
                    }

                    return false;
                }

                label79: {
                    Integer var11 = this.getConnectionTimeout();
                    Integer var12 = var2.getConnectionTimeout();
                    if (var11 == null) {
                        if (var12 == null) {
                            break label79;
                        }
                    } else if (var11.equals(var12)) {
                        break label79;
                    }

                    return false;
                }

                label72: {
                    Boolean var13 = this.getAutoCommit();
                    Boolean var14 = var2.getAutoCommit();
                    if (var13 == null) {
                        if (var14 == null) {
                            break label72;
                        }
                    } else if (var13.equals(var14)) {
                        break label72;
                    }

                    return false;
                }

                String var15 = this.getPoolName();
                String var16 = var2.getPoolName();
                if (var15 == null) {
                    if (var16 != null) {
                        return false;
                    }
                } else if (!var15.equals(var16)) {
                    return false;
                }

                String var17 = this.getConnectionTestQuery();
                String var18 = var2.getConnectionTestQuery();
                if (var17 == null) {
                    if (var18 != null) {
                        return false;
                    }
                } else if (!var17.equals(var18)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof HikariDataSourceConfig;
    }

    @Override
    public int hashCode() {
        boolean var1 = true;
        byte var2 = 1;
        Integer var3 = this.getMinimumDdle();
        int var11 = var2 * 59 + (var3 == null ? 43 : var3.hashCode());
        Integer var4 = this.getMaximumPoolSize();
        var11 = var11 * 59 + (var4 == null ? 43 : var4.hashCode());
        Integer var5 = this.getIdleTimeout();
        var11 = var11 * 59 + (var5 == null ? 43 : var5.hashCode());
        Integer var6 = this.getMaxLifetime();
        var11 = var11 * 59 + (var6 == null ? 43 : var6.hashCode());
        Integer var7 = this.getConnectionTimeout();
        var11 = var11 * 59 + (var7 == null ? 43 : var7.hashCode());
        Boolean var8 = this.getAutoCommit();
        var11 = var11 * 59 + (var8 == null ? 43 : var8.hashCode());
        String var9 = this.getPoolName();
        var11 = var11 * 59 + (var9 == null ? 43 : var9.hashCode());
        String var10 = this.getConnectionTestQuery();
        var11 = var11 * 59 + (var10 == null ? 43 : var10.hashCode());
        return var11;
    }

    @Override
    public String toString() {
        return "HikariDataSourceConfig(minimumDdle=" + this.getMinimumDdle() + ", maximumPoolSize=" + this.getMaximumPoolSize() + ", idleTimeout=" + this.getIdleTimeout() + ", maxLifetime=" + this.getMaxLifetime() + ", poolName=" + this.getPoolName() + ", connectionTestQuery=" + this.getConnectionTestQuery() + ", connectionTimeout=" + this.getConnectionTimeout() + ", autoCommit=" + this.getAutoCommit() + ")";
    }
}
